package com.badlogic.agdwikisamples;

import android.app.ListActivity;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

/**
 * Sample chooser activity. 
 * @author mzechner
 *
 */
public class SampleChooser extends ListActivity 
{
	String[] samples = new String[] {
			"Loop Benchmark",
			"Bulk Put Benchmark",
			"Touch CPU Usage",
			"Touch Flood Sample",
			"VBO Update Bug",
	};
	
	public void onCreate( Bundle bundle )
	{
		super.onCreate( bundle );
		setListAdapter( new ArrayAdapter<String>( this, android.R.layout.simple_list_item_1, samples ));
		setRequestedOrientation( ActivityInfo.SCREEN_ORIENTATION_PORTRAIT );
	}
	
	protected void onListItemClick(ListView l, View v, int position, long id)
	{
		super.onListItemClick(l, v, position, id);
		Intent intent = null;
		
		switch( position )
		{
		case 0:
			intent = new Intent( this, LoopBenchmark.class );
			break;
		case 1:
			intent = new Intent( this, BulkPutBenchmark.class );
			break;
		case 2:
			intent = new Intent( this, TouchCpuUsageSample.class );
			break;
		case 3:
			intent = new Intent( this, TouchFloodSample.class );
			break;
		case 4:
			intent = new Intent( this, VBOUpdateBug.class );
			break;
		default: 
			break;
		}
		
		if( intent != null )
			startActivity( intent );
	}
}